Skip to content

fix: close segment writer on error paths in sort compaction#48534

Open
sunby wants to merge 1 commit intomilvus-io:masterfrom
sunby:fix-sort-compaction-writer-leak
Open

fix: close segment writer on error paths in sort compaction#48534
sunby wants to merge 1 commit intomilvus-io:masterfrom
sunby:fix-sort-compaction-writer-leak

Conversation

@sunby
Copy link
Contributor

@sunby sunby commented Mar 26, 2026

Close BinlogRecordWriter on error paths in sortSegment to prevent resource leak.

issue: #48533

In sortSegment, when the BinlogRecordWriter (srw) is created but
subsequent operations fail (ComposeDeleteFromDeltalogs, record reader
creation, or Sort), the writer is not closed, leaking resources.

Fix by calling srw.Close() on each error path.

Signed-off-by: sunby <sunbingyi1992@gmail.com>
@sre-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: sunby
To complete the pull request process, please assign zhengbuqian after the PR has been reviewed.
You can assign the PR to them by writing /assign @zhengbuqian in a comment when ready.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@sre-ci-robot sre-ci-robot added the size/XS Denotes a PR that changes 0-9 lines. label Mar 26, 2026
@mergify mergify bot added dco-passed DCO check passed. kind/bug Issues or changes related a bug labels Mar 26, 2026
@sre-ci-robot
Copy link
Contributor

[ci-v2-notice]
Notice: New ci-v2 system is enabled for this PR.

To rerun ci-v2 checks, comment with:

  • /ci-rerun-code-check // for ci-v2/code-check
  • /ci-rerun-build // for ci-v2/build
  • /ci-rerun-build-all // for ci-v2/build-all (multi-arch builds)
  • /ci-rerun-buildenv // for ci-v2/build-env (build milvus-env builder images)
  • /ci-rerun-ut-integration // for ci-v2/ut-integration, will rerun ci-v2/build
  • /ci-rerun-ut-go // for ci-v2/ut-go, will rerun ci-v2/build
  • /ci-rerun-ut-cpp // for ci-v2/ut-cpp
  • /ci-rerun-ut // for all ci-v2/ut-integration, ci-v2/ut-go, ci-v2/ut-cpp, will rerun ci-v2/build
  • /ci-rerun-e2e-arm // for ci-v2/e2e-arm
  • /ci-rerun-e2e-default // for ci-v2/e2e-default
  • /ci-rerun-ciloop // for ci-v2/ciloop (build + unit tests in one pipeline)
  • /ci-rerun-gosdk // for ci-v2/go-sdk (Go SDK E2E tests, AMD)
  • /ci-rerun-gosdk-arm // for ci-v2/go-sdk-arm (Go SDK E2E tests, ARM)

If you have any questions or requests, please contact @zhikunyao.

@codecov
Copy link

codecov bot commented Mar 26, 2026

Codecov Report

❌ Patch coverage is 0% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 77.63%. Comparing base (1c0302a) to head (343001b).
⚠️ Report is 6 commits behind head on master.

Files with missing lines Patch % Lines
internal/datanode/compactor/sort_compaction.go 0.00% 3 Missing ⚠️

❌ Your patch check has failed because the patch coverage (0.00%) is below the target coverage (80.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           master   #48534       +/-   ##
===========================================
+ Coverage   74.95%   77.63%    +2.67%     
===========================================
  Files        1485     2112      +627     
  Lines      247232   351449   +104217     
===========================================
+ Hits       185323   272831    +87508     
- Misses      53589    70290    +16701     
- Partials     8320     8328        +8     
Components Coverage Δ
Client 79.25% <ø> (ø)
Core 84.01% <ø> (∅)
Go 75.80% <0.00%> (-0.03%) ⬇️
Files with missing lines Coverage Δ
internal/datanode/compactor/sort_compaction.go 59.62% <0.00%> (-0.38%) ⬇️

... and 657 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@sre-ci-robot sre-ci-robot added the low-code-coverage add test-label from zhikun, diff coverage > 80% label Mar 26, 2026
@sunby
Copy link
Contributor Author

sunby commented Mar 26, 2026

/ci-rerun-e2e-arm

@sunby
Copy link
Contributor Author

sunby commented Mar 26, 2026

/ci-rerun-go-sdk

2 similar comments
@sunby
Copy link
Contributor Author

sunby commented Mar 26, 2026

/ci-rerun-go-sdk

@sunby
Copy link
Contributor Author

sunby commented Mar 26, 2026

/ci-rerun-go-sdk

@sunby
Copy link
Contributor Author

sunby commented Mar 26, 2026

/ci-rerun-e2e-arm
/ci-rerun-go-sdk

@sunby
Copy link
Contributor Author

sunby commented Mar 26, 2026

/ci-rerun-go-sdk

1 similar comment
@sunby
Copy link
Contributor Author

sunby commented Mar 26, 2026

/ci-rerun-go-sdk

@sunby
Copy link
Contributor Author

sunby commented Mar 26, 2026

/ci-rerun-integration-test

@sunby
Copy link
Contributor Author

sunby commented Mar 26, 2026

/ci-rerun-go-sdk

11 similar comments
@sunby
Copy link
Contributor Author

sunby commented Mar 26, 2026

/ci-rerun-go-sdk

@sunby
Copy link
Contributor Author

sunby commented Mar 26, 2026

/ci-rerun-go-sdk

@sunby
Copy link
Contributor Author

sunby commented Mar 26, 2026

/ci-rerun-go-sdk

@sunby
Copy link
Contributor Author

sunby commented Mar 26, 2026

/ci-rerun-go-sdk

@sunby
Copy link
Contributor Author

sunby commented Mar 26, 2026

/ci-rerun-go-sdk

@sunby
Copy link
Contributor Author

sunby commented Mar 26, 2026

/ci-rerun-go-sdk

@sunby
Copy link
Contributor Author

sunby commented Mar 26, 2026

/ci-rerun-go-sdk

@sunby
Copy link
Contributor Author

sunby commented Mar 26, 2026

/ci-rerun-go-sdk

@sunby
Copy link
Contributor Author

sunby commented Mar 26, 2026

/ci-rerun-go-sdk

@sunby
Copy link
Contributor Author

sunby commented Mar 26, 2026

/ci-rerun-go-sdk

@sunby
Copy link
Contributor Author

sunby commented Mar 26, 2026

/ci-rerun-go-sdk

@sunby
Copy link
Contributor Author

sunby commented Mar 26, 2026

/ci-rerun-go-sdk

13 similar comments
@sunby
Copy link
Contributor Author

sunby commented Mar 26, 2026

/ci-rerun-go-sdk

@sunby
Copy link
Contributor Author

sunby commented Mar 26, 2026

/ci-rerun-go-sdk

@sunby
Copy link
Contributor Author

sunby commented Mar 26, 2026

/ci-rerun-go-sdk

@sunby
Copy link
Contributor Author

sunby commented Mar 26, 2026

/ci-rerun-go-sdk

@sunby
Copy link
Contributor Author

sunby commented Mar 26, 2026

/ci-rerun-go-sdk

@sunby
Copy link
Contributor Author

sunby commented Mar 26, 2026

/ci-rerun-go-sdk

@sunby
Copy link
Contributor Author

sunby commented Mar 26, 2026

/ci-rerun-go-sdk

@sunby
Copy link
Contributor Author

sunby commented Mar 26, 2026

/ci-rerun-go-sdk

@sunby
Copy link
Contributor Author

sunby commented Mar 26, 2026

/ci-rerun-go-sdk

@sunby
Copy link
Contributor Author

sunby commented Mar 26, 2026

/ci-rerun-go-sdk

@sunby
Copy link
Contributor Author

sunby commented Mar 26, 2026

/ci-rerun-go-sdk

@sunby
Copy link
Contributor Author

sunby commented Mar 26, 2026

/ci-rerun-go-sdk

@sunby
Copy link
Contributor Author

sunby commented Mar 26, 2026

/ci-rerun-go-sdk

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dco-passed DCO check passed. kind/bug Issues or changes related a bug low-code-coverage add test-label from zhikun, diff coverage > 80% size/XS Denotes a PR that changes 0-9 lines.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants